{include file="public/layout" /}
<body class="bodystyle" style="overflow-y: scroll;min-width:auto;">
<div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page min-hg-c-10">
    <form class="form-horizontal" id="post_form" action="{:url('Language/edit')}" method="post">
        <div class="ncap-form-default">
            <dl class="row">
                <dt class="tit">
                    <label for="title">中文名称</label>
                </dt>
                <dd class="opt" style="width: auto;">
                    {$row.cn_title}
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="title">语言名称</label>
                </dt>
                <dd class="opt" style="width: auto;">
                    <input type="text" name="title" id="title" value="{$row.title}" class="w200" autocomplete="off">
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="logo">国旗标志</label>
                </dt>
                <dd class="opt" style="width: auto;">
                    <img src="__STATIC__/common/images/language/{$row.mark}.gif" alt="{$row.title}"/>
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>语言状态</label>
                </dt>
                <dd class="opt" style="width: auto;">
                    {gt name='$count' value='1'}
                        <label class="curpoin"><input type="radio" name="status" value="1" {if condition="!empty($row['status'])"} checked="checked" {/if}/>开启</label>&nbsp;&nbsp;
                        <label class="curpoin"><input type="radio" name="status" value="0" {if condition="empty($row['status'])"} checked="checked" {/if}/>关闭</label>&nbsp;&nbsp;
                    {else /}
                        开启
                        <input type="hidden" name="status" value="1">
                    {/gt}
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>前台默认语言</label>
                </dt>
                <dd class="opt" style="width: auto;">
                    {gt name='$count' value='1'}
                        <label class="curpoin"><input type="radio" name="is_home_default" value="1" {if condition="!empty($row['is_home_default'])"} checked="checked" {/if}/>是</label>&nbsp;&nbsp;
                        <label class="curpoin"><input type="radio" name="is_home_default" value="0" {if condition="empty($row['is_home_default'])"} checked="checked" {/if}/>否</label>&nbsp;&nbsp;
                    {else /}
                        是
                        <input type="hidden" name="is_home_default" value="1">
                    {/gt}
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>新窗口打开</label>
                </dt>
                <dd class="opt" style="width: auto;">
                    <label class="curpoin"><input type="radio" name="target" value="1" {if condition="!empty($row['target'])"} checked="checked" {/if}/>是</label>&nbsp;&nbsp;
                    <label class="curpoin"><input type="radio" name="target" value="0" {if condition="empty($row['target'])"} checked="checked" {/if}/>否</label>&nbsp;&nbsp;
                </dd>
            </dl>
            <!-- <dl class="row">
                <dt class="tit">
                    <label for="url">单独域名</label>
                </dt>
                <dd class="opt" style="width: auto;">
                    <input type="text" name="url" value="{$row.url}" id="url" class="input-txt">
                    <span class="err"></span>
                    <p class=""><font color="red">务必包含http://或https://，访问该域名程序将自动跳转到此语言（需先做好域名解析绑定），或者做外部链接用。</font></p>
                </dd>
            </dl> -->
            <dl class="row">
                <dt class="tit">
                    <label for="sort_order">排序</label>
                </dt>
                <dd class="opt" style="width: auto;">
                    <input type="text" name="sort_order" value="{$row.sort_order|default='100'}" id="sort_order" class="w200" autocomplete="off">
                    <span class="err"></span>
                    <p class="notic">越小越靠前</p>
                </dd>
            </dl>
            <div class="bot mt30">
                <input type="hidden" name="id" value="{$row.id}" />
                <input type="hidden" name="mark" value="{$row.mark}" />
                <a href="JavaScript:void(0);" onclick="checkForm();" class="ncap-btn-big ncap-btn-green" id="submitBtn">确认提交</a>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript">

    var parentObj = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
    $(function(){
        /*选择多语言*/
        $('#langautor').change(function(){
            var title = $(this).find("option:selected").text();
            $('input[name=title]').val(title);
        });
        /*--end*/
    });

    // 判断输入框是否为空
    function checkForm(){
        if($('#langautor').val() == ''){
            showErrorMsg('请选择语言！');
            $('#langautor').focus();
            return false;
        }
        if($('input[name=title]').val() == ''){
            showErrorMsg('语言名称不能为空！');
            $('input[name=title]').focus();
            return false;
        }
        layer_loading('正在处理');
        $.ajax({
            type : 'post',
            url : "{:url('Language/edit', ['_ajax'=>1])}",
            data : $('#post_form').serialize(),
            dataType : 'json',
            success : function(res){
                layer.closeAll();
                if(res.code == 1){
                    var _parent = parent;
                    _parent.layer.msg(res.msg, {shade: layer_shade, time: 1000}, function(){
                        _parent.window.location.reload();
                    });
                }else{
                    showErrorMsg(res.msg);
                }
            },
            error: function(e){
                layer.closeAll();
                showErrorAlert(e.responseText);
            }
        });
    }
</script>
{include file="public/footer" /}